<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>localStorage</h2>
<button onclick="saveData()">点我保存一个数据</button>

<!--
    存储内存大小一般支持5MB
    浏览器通过
    Window.sessionStorage // 浏览器关闭就没了

    Window.localStorage // 浏览器关闭还存在
-->
<script type="text/javascript">
    let p = {name:"张三", age: 18}
    function saveData() {
        this.sessionStorage.setItem("msg", "1")
        this.sessionStorage.setItem("person", JSON.stringify(p))
    }
</script>
</body>
</html>